<?php
	require_once '../Tool/Common/PrepareInput.php';

    session_start();
    if (empty($_SESSION["userType"])) {
        $url="../Index.php";
        include_once '../Tool/Common/Redirect.php';
        exit();
    }

    if($_SESSION["userType"]=="Therapy Assistant"){
        $url="../Index.php";
        include_once '../Tool/Common/Redirect.php';
        exit();
    }
    
    $InsertActivityName=$InsertCategory=$InsertCentreName="";  

    if(isset($_REQUEST['InsertActivityName'])){ 
        $InsertActivityName=prepareInput($_REQUEST['InsertActivityName']); 
    }
    if(isset($_REQUEST['InsertCategory'])) { 
        $InsertCategory=prepareInput($_REQUEST['InsertCategory']); 
    }
    if(isset($_REQUEST['InsertCentreName'])) { 
        $InsertCentreName=prepareInput($_REQUEST['InsertCentreName']); 
    }

    $result=array();

    $result['flagActivityName']=0;  
    $result['flagCategory']=0;
    $result['flagCentreName']=0;

    if(preg_match("/^[A-Za-z0-9() ]*$/",$InsertActivityName)&&!empty($InsertActivityName)){
        $result['flagActivityName']=1;
    }
    if(preg_match("/^[A-Za-z0-9 ]*$/",$InsertCategory)&&!empty($InsertCategory)){
        $result['flagCategory']=1;
    }
    if(preg_match("/^[A-Za-z0-9() ]*$/",$InsertCentreName)&&!empty($InsertCentreName)){
        $result['flagCentreName']=1;
    }

    echo json_encode($result);
?>